home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2003 March / DPPCPRO0303.ISO / Extras / Content / Images / Studio NetObjects / Java Applets / TickerTape / TickerTape.class (.txt) next >
Encoding:
Java Class File  |  1998-10-22  |  28.7 KB  |  800 lines

  1. import java.applet.Applet;
  2. import java.awt.Color;
  3. import java.awt.Component;
  4. import java.awt.Dimension;
  5. import java.awt.Event;
  6. import java.awt.Graphics;
  7. import java.awt.Image;
  8. import java.net.MalformedURLException;
  9. import java.net.URL;
  10. import java.util.Vector;
  11.  
  12. public class TickerTape extends Applet implements Runnable {
  13.    int[] starts;
  14.    URL[] theURLs;
  15.    int numTokens;
  16.    long speed = 250L;
  17.    int theOffScreenPosition;
  18.    int theDisplayWidth;
  19.    int frameThickness;
  20.    int ledSize;
  21.    int scrollFactor;
  22.    int ledSpacing;
  23.    int ledType;
  24.    Thread tickTock;
  25.    Graphics offScreenGraphics;
  26.    Dimension offScreenSize;
  27.    Image offScreenImage;
  28.    Color frameColour;
  29.    Color backGround;
  30.    Color LEDColour;
  31.    Color LEDOffColour;
  32.    int theXOffset;
  33.    int theYOffset;
  34.    URL theURLToGoTo;
  35.    boolean mouseOut = true;
  36.    boolean notUpdatedYet = true;
  37.    int[][] itsData = new int[][]{{0, 0, 0, 0, 0, 0}, {0, 0, 380, 0, 0, 0}, {0, 12, 0, 12, 0, 0}, {80, 248, 80, 248, 80, 0}, {16, 168, 508, 168, 64, 0}, {140, 76, 32, 400, 392, 0}, {200, 308, 340, 136, 320, 0}, {0, 0, 12, 0, 0, 0}, {0, 248, 260, 0, 0, 0}, {0, 0, 260, 248, 0, 0}, {168, 112, 508, 112, 168, 0}, {0, 32, 112, 32, 0, 0}, {0, 512, 384, 0, 0, 0}, {0, 32, 32, 32, 0, 0}, {0, 0, 256, 0, 0, 0}, {128, 64, 32, 16, 8, 0}, {112, 136, 260, 136, 112, 0}, {0, 272, 508, 256, 0, 0}, {408, 324, 324, 292, 280, 0}, {136, 260, 260, 292, 216, 0}, {48, 40, 36, 508, 32, 0}, {316, 292, 292, 292, 192, 0}, {248, 292, 292, 292, 192, 0}, {0, 4, 388, 100, 28, 0}, {216, 292, 292, 292, 216, 0}, {24, 292, 292, 292, 248, 0}, {0, 0, 160, 0, 0, 0}, {0, 512, 416, 0, 0, 0}, {0, 32, 80, 136, 0, 0}, {0, 80, 80, 80, 0, 0}, {0, 136, 80, 32, 0, 0}, {8, 4, 324, 36, 24, 0}, {248, 260, 372, 340, 56, 0}, {496, 72, 68, 72, 496, 0}, {508, 292, 292, 292, 216, 0}, {248, 260, 260, 260, 136, 0}, {508, 260, 260, 260, 248, 0}, {508, 292, 292, 292, 260, 0}, {508, 36, 36, 4, 4, 0}, {248, 260, 260, 292, 232, 0}, {508, 32, 32, 32, 508, 0}, {0, 0, 508, 0, 0, 0}, {192, 256, 256, 256, 252, 0}, {508, 32, 80, 136, 260, 0}, {508, 256, 256, 256, 256, 0}, {508, 8, 16, 8, 508, 0}, {508, 8, 16, 32, 508, 0}, {248, 260, 260, 260, 248, 0}, {508, 36, 36, 36, 24, 0}, {248, 260, 324, 388, 504, 0}, {508, 36, 100, 164, 280, 0}, {152, 292, 292, 292, 200, 0}, {4, 4, 508, 4, 4, 0}, {252, 256, 256, 256, 252, 0}, {124, 128, 256, 128, 124, 0}, {252, 256, 128, 256, 252, 0}, {260, 136, 112, 136, 260, 0}, {12, 16, 480, 16, 12, 0}, {388, 324, 292, 276, 268, 0}, {0, 508, 260, 260, 0, 0}, {8, 16, 32, 64, 128, 0}, {0, 260, 260, 508, 0, 0}, {0, 32, 16, 32, 0, 0}, {256, 256, 256, 256, 256, 0}, {0, 4, 8, 0, 0, 0}, {128, 336, 336, 224, 256, 0}, {508, 288, 272, 272, 224, 0}, {224, 272, 272, 272, 0, 0}, {224, 272, 272, 292, 508, 0}, {224, 336, 336, 336, 96, 0}, {16, 504, 20, 4, 0, 0}, {224, 1296, 1296, 1296, 992, 0}, {4, 508, 16, 16, 480, 0}, {0, 0, 500, 0, 0, 0}, {512, 1024, 1012, 0, 0, 0}, {0, 508, 64, 160, 272, 0}, {0, 4, 508, 0, 0, 0}, {480, 16, 96, 16, 480, 0}, {496, 16, 16, 480, 0, 0}, {224, 272, 272, 272, 224, 0}, {2032, 160, 272, 272, 224, 0}, {224, 272, 272, 160, 2032, 0}, {0, 496, 32, 16, 16, 0}, {288, 336, 336, 336, 144, 0}, {0, 16, 252, 272, 0, 0}, {240, 256, 256, 256, 240, 0}, {48, 192, 256, 192, 48, 0}, {240, 256, 192, 256, 240, 0}, {272, 160, 64, 160, 272, 0}, {0, 1264, 1280, 768, 240, 0}, {272, 400, 336, 304, 272, 0}, {0, 32, 216, 260, 0, 0}, {0, 0, 508, 0, 0, 0}, {0, 260, 216, 32, 0, 0}, {32, 16, 32, 64, 32, 0}, {0, 0, 500, 0, 0, 0}, {224, 272, 1016, 272, 0, 0}, {278, 249, 273, 273, 128, 0}, {136, 112, 80, 112, 136, 0}, {44, 56, 488, 56, 44, 0}, {0, 0, 476, 0, 0, 0}, {56, 340, 340, 340, 224, 0}, {0, 4, 0, 4, 0, 0}, {248, 372, 396, 340, 248, 0}, {80, 106, 106, 106, 124, 0}, {32, 80, 168, 80, 136, 0}, {32, 32, 32, 32, 224, 0}, {32, 32, 32, 32, 32, 0}, {500, 212, 292, 260, 504, 0}, {0, 4, 4, 4, 0, 0}, {0, 7, 5, 7, 0, 0}, {0, 160, 240, 160, 0, 0}, {0, 9, 13, 11, 0, 0}, {0, 9, 11, 13, 0, 0}, {0, 4, 2, 0, 0, 0}, {1024, 1008, 256, 256, 240, 0}, {24, 36, 36, 508, 508, 0}, {0, 56, 56, 56, 0, 0}, {0, 1024, 1536, 0, 0, 0}, {0, 2, 15, 0, 0, 0}, {92, 98, 98, 98, 92, 0}, {136, 80, 168, 80, 32, 0}, {132, 94, 160, 208, 488, 0}, {68, 62, 336, 424, 320, 0}, {146, 86, 186, 208, 488, 0}, {128, 256, 276, 288, 192, 0}, {496, 73, 70, 72, 496, 0}, {496, 74, 69, 72, 496, 0}, {496, 74, 69, 74, 496, 0}, {498, 73, 70, 73, 496, 0}, {496, 74, 68, 74, 496, 0}, {496, 75, 71, 75, 496, 0}, {504, 36, 508, 292, 292, 0}, {248, 1284, 1796, 260, 136, 0}, {508, 293, 294, 292, 292, 0}, {508, 294, 293, 292, 292, 0}, {508, 294, 293, 294, 292, 0}, {508, 294, 292, 294, 292, 0}, {0, 0, 509, 2, 0, 0}, {0, 2, 509, 0, 0, 0}, {0, 2, 509, 2, 0, 0}, {0, 2, 508, 2, 0, 0}, {0, 0, 128, 320, 0, 0}, {510, 9, 18, 33, 508, 0}, {248, 261, 262, 260, 248, 0}, {248, 262, 261, 260, 248, 0}, {248, 262, 261, 262, 248, 0}, {250, 261, 262, 261, 248, 0}, {248, 262, 260, 262, 248, 0}, {0, 80, 32, 80, 0, 0}, {240, 200, 168, 152, 120, 0}, {252, 257, 258, 256, 252, 0}, {252, 258, 257, 256, 252, 0}, {252, 258, 257, 258, 252, 0}, {252, 258, 256, 258, 252, 0}, {12, 18, 481, 16, 12, 0}, {16, 504, 20, 492, 0, 0}, {508, 276, 276, 296, 192, 0}, {128, 338, 340, 224, 256, 0}, {128, 340, 338, 224, 256, 0}, {128, 340, 338, 228, 256, 0}, {132, 338, 340, 226, 256, 0}, {128, 340, 336, 228, 256, 0}, {128, 342, 342, 224, 256, 0}, {400, 336, 224, 336, 352, 0}, {224, 1296, 1808, 272, 0, 0}, {224, 338, 340, 336, 96, 0}, {224, 340, 338, 336, 96, 0}, {224, 340, 338, 340, 96, 0}, {224, 340, 336, 340, 96, 0}, {0, 2, 500, 0, 0, 0}, {0, 4, 498, 0, 0, 0}, {0, 4, 498, 4, 0, 0}, {0, 4, 496, 4, 0, 0}, {0, 0, 280, 128, 0, 0}, {500, 18, 20, 482, 0, 0}, {224, 274, 276, 272, 224, 0}, {224, 276, 274, 272, 224, 0}, {224, 276, 274, 276, 224, 0}, {228, 274, 276, 274, 224, 0}, {224, 276, 272, 276, 224, 0}, {32, 32, 168, 32, 32, 0}, {224, 400, 336, 304, 224, 0}, {240, 258, 260, 256, 240, 0}, {240, 260, 258, 256, 240, 0}, {240, 260, 258, 260, 240, 0}, {240, 260, 256, 260, 240, 0}, {0, 1268, 1282, 768, 240, 0}, {16, 504, 20, 508, 0, 0}, {0, 1268, 1280, 772, 240, 0}};
  38.    String[] theEntities = new String[]{"�", "", "", "", "", "", "", "", "", " ", " ", " ", " ", " ", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "&sp;", "!", """, "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "‐", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "\", "]", "ˆ", "_", "`", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "˜", "", "€", "", "‚", "ƒ", "„", "…", "†", "‡", "ˆ", "‰", "Š", "‹", "Œ", "", "Ž", "", "", "‘", "’", "“", "”", "•", "–", "—", "˜", "™", "š", "›", "œ", "", "ž", "Ÿ", " ", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "­", "®", "&hibar;", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ"};
  39.  
  40.    public int GetLine(char theCharacter, int theLine) {
  41.       int index = theCharacter & 255;
  42.       if (index >= 127 && index <= 160) {
  43.          index = 32;
  44.       } else if (index > 160) {
  45.          index -= 34;
  46.       }
  47.  
  48.       index -= 32;
  49.       if (index < 0) {
  50.          index = 0;
  51.       } else if (index > 189) {
  52.          index = 0;
  53.       }
  54.  
  55.       return this.itsData[index][theLine];
  56.    }
  57.  
  58.    public void start() {
  59.       if (this.tickTock == null) {
  60.          this.tickTock = new Thread(this);
  61.          this.tickTock.start();
  62.       }
  63.  
  64.    }
  65.  
  66.    public String[][] getParameterInfo() {
  67.       String[][] info = new String[][]{{"text1", "string", "the text to display"}, {"speed", "integer", ""}, {"framecolor", "string", ""}, {"backcolor", "string", ""}, {"LEDcolor", "string", ""}, {"ledoffcolor", "string", ""}, {"FrameThick", "integer", ""}, {"LEDSize", "integer", ""}, {"scrollfactor", "integer", ""}, {"ledspacing", "integer", ""}, {"ledtype", "integer", "The shape of the LED: 0 = Square and 1 = Circular"}, {"href1", "URL", ""}};
  68.       return info;
  69.    }
  70.  
  71.    public void stop() {
  72.       if (this.tickTock != null) {
  73.          this.tickTock.stop();
  74.          this.tickTock = null;
  75.       }
  76.  
  77.    }
  78.  
  79.    public int HTMLtoISO(String theString) {
  80.       char secondChar = theString.charAt(1);
  81.       if (theString.charAt(0) != '&') {
  82.          return 0;
  83.       } else if (Character.isDigit(theString.charAt(1))) {
  84.          int result = Integer.valueOf(theString.substring(1, theString.indexOf(59, 2)));
  85.          return result;
  86.       } else {
  87.          switch (secondChar) {
  88.             case 'A':
  89.                if (theString.startsWith("Agrave;", 1)) {
  90.                   return 192;
  91.                } else if (theString.startsWith("Aacute;", 1)) {
  92.                   return 193;
  93.                } else if (theString.startsWith("Acirc;", 1)) {
  94.                   return 194;
  95.                } else if (theString.startsWith("Atilde;", 1)) {
  96.                   return 195;
  97.                } else if (theString.startsWith("Auml;", 1)) {
  98.                   return 196;
  99.                } else if (theString.startsWith("Aring;", 1)) {
  100.                   return 197;
  101.                } else if (theString.startsWith("AElig;", 1)) {
  102.                   return 198;
  103.                }
  104.             case 'C':
  105.                if (theString.startsWith("Ccedil;", 1)) {
  106.                   return 199;
  107.                }
  108.             case 'D':
  109.                if (theString.startsWith("Dstrok;", 1)) {
  110.                   return 208;
  111.                }
  112.             case 'E':
  113.                if (theString.startsWith("Egrave;", 1)) {
  114.                   return 200;
  115.                } else if (theString.startsWith("Eacute;", 1)) {
  116.                   return 201;
  117.                } else if (theString.startsWith("Ecirc;", 1)) {
  118.                   return 202;
  119.                } else if (theString.startsWith("Euml;", 1)) {
  120.                   return 203;
  121.                } else if (theString.startsWith("ETH;", 1)) {
  122.                   return 208;
  123.                }
  124.             case 'I':
  125.                if (theString.startsWith("Igrave;", 1)) {
  126.                   return 204;
  127.                } else if (theString.startsWith("Iacute;", 1)) {
  128.                   return 205;
  129.                } else if (theString.startsWith("Icirc;", 1)) {
  130.                   return 206;
  131.                } else if (theString.startsWith("Iuml;", 1)) {
  132.                   return 207;
  133.                }
  134.             case 'N':
  135.                if (theString.startsWith("Ntilde;", 1)) {
  136.                   return 209;
  137.                }
  138.             case 'O':
  139.                if (theString.startsWith("Ograve;", 1)) {
  140.                   return 210;
  141.                } else if (theString.startsWith("Oacute;", 1)) {
  142.                   return 211;
  143.                } else if (theString.startsWith("Ocirc;", 1)) {
  144.                   return 212;
  145.                } else if (theString.startsWith("Otilde;", 1)) {
  146.                   return 213;
  147.                } else if (theString.startsWith("Ouml;", 1)) {
  148.                   return 214;
  149.                } else if (theString.startsWith("Oslash;", 1)) {
  150.                   return 216;
  151.                }
  152.             case 'T':
  153.                if (theString.startsWith("THORN;", 1)) {
  154.                   return 222;
  155.                }
  156.             case 'U':
  157.                if (theString.startsWith("Ugrave;", 1)) {
  158.                   return 217;
  159.                } else if (theString.startsWith("Uacute;", 1)) {
  160.                   return 218;
  161.                } else if (theString.startsWith("Ucirc;", 1)) {
  162.                   return 219;
  163.                } else if (theString.startsWith("Uuml;", 1)) {
  164.                   return 220;
  165.                }
  166.             case 'Y':
  167.                if (theString.startsWith("Yacute;", 1)) {
  168.                   return 221;
  169.                }
  170.             case 'a':
  171.                if (theString.startsWith("agrave;", 1)) {
  172.                   return 224;
  173.                } else if (theString.startsWith("aacute;", 1)) {
  174.                   return 225;
  175.                } else if (theString.startsWith("acirc;", 1)) {
  176.                   return 226;
  177.                } else if (theString.startsWith("atilde;", 1)) {
  178.                   return 227;
  179.                } else if (theString.startsWith("auml;", 1)) {
  180.                   return 228;
  181.                } else if (theString.startsWith("aring;", 1)) {
  182.                   return 229;
  183.                } else if (theString.startsWith("aelig;", 1)) {
  184.                   return 230;
  185.                } else if (theString.startsWith("amp;", 1)) {
  186.                   return 38;
  187.                } else if (theString.startsWith("apos;", 1)) {
  188.                   return 39;
  189.                } else if (theString.startsWith("ast;", 1)) {
  190.                   return 42;
  191.                } else if (theString.startsWith("acute;", 1)) {
  192.                   return 180;
  193.                } else if (theString.startsWith("angst;", 1)) {
  194.                   return 197;
  195.                }
  196.             case 'b':
  197.                if (theString.startsWith("blank;", 1)) {
  198.                   return 32;
  199.                } else if (theString.startsWith("bsol;", 1)) {
  200.                   return 92;
  201.                } else if (theString.startsWith("brvbar;", 1)) {
  202.                   return 166;
  203.                } else if (theString.startsWith("brkbar;", 1)) {
  204.                   return 166;
  205.                }
  206.             case 'c':
  207.                if (theString.startsWith("ccedil;", 1)) {
  208.                   return 231;
  209.                } else if (theString.startsWith("comma;", 1)) {
  210.                   return 44;
  211.                } else if (theString.startsWith("colon;", 1)) {
  212.                   return 58;
  213.                } else if (theString.startsWith("commat;", 1)) {
  214.                   return 64;
  215.                } else if (theString.startsWith("circ;", 1)) {
  216.                   return 94;
  217.                } else if (theString.startsWith("caret;", 1)) {
  218.                   return 94;
  219.                } else if (theString.startsWith("cent;", 1)) {
  220.                   return 162;
  221.                } else if (theString.startsWith("curren;", 1)) {
  222.                   return 164;
  223.                } else if (theString.startsWith("copy;", 1)) {
  224.                   return 169;
  225.                } else if (theString.startsWith("cedil;", 1)) {
  226.                   return 184;
  227.                }
  228.             case 'd':
  229.                if (theString.startsWith("divide;", 1)) {
  230.                   return 247;
  231.                } else if (theString.startsWith("dollar;", 1)) {
  232.                   return 36;
  233.                } else if (theString.startsWith("dash;", 1)) {
  234.                   return 45;
  235.                } else if (theString.startsWith("die;", 1)) {
  236.                   return 168;
  237.                } else if (theString.startsWith("deg;", 1)) {
  238.                   return 176;
  239.                }
  240.             case 'e':
  241.                if (theString.startsWith("egrave;", 1)) {
  242.                   return 232;
  243.                } else if (theString.startsWith("eacute;", 1)) {
  244.                   return 233;
  245.                } else if (theString.startsWith("ecirc;", 1)) {
  246.                   return 234;
  247.                } else if (theString.startsWith("euml;", 1)) {
  248.                   return 235;
  249.                } else if (theString.startsWith("eth;", 1)) {
  250.                   return 240;
  251.                } else if (theString.startsWith("excl;", 1)) {
  252.                   return 33;
  253.                } else if (theString.startsWith("equals;", 1)) {
  254.                   return 61;
  255.                }
  256.             case 'f':
  257.                if (theString.startsWith("frac14;", 1)) {
  258.                   return 188;
  259.                } else if (theString.startsWith("frac12;", 1)) {
  260.                   return 189;
  261.                } else if (theString.startsWith("frac34;", 1)) {
  262.                   return 190;
  263.                }
  264.             case 'g':
  265.                if (theString.startsWith("gt;", 1)) {
  266.                   return 62;
  267.                } else if (theString.startsWith("grave;", 1)) {
  268.                   return 96;
  269.                }
  270.             case 'h':
  271.                if (theString.startsWith("hyphen;", 1)) {
  272.                   return 45;
  273.                } else if (theString.startsWith("hibar;", 1)) {
  274.                   return 175;
  275.                } else if (theString.startsWith("half;", 1)) {
  276.                   return 189;
  277.                }
  278.             case 'i':
  279.                if (theString.startsWith("igrave;", 1)) {
  280.                   return 236;
  281.                } else if (theString.startsWith("iacute;", 1)) {
  282.                   return 237;
  283.                } else if (theString.startsWith("icirc;", 1)) {
  284.                   return 238;
  285.                } else if (theString.startsWith("iuml;", 1)) {
  286.                   return 239;
  287.                } else if (theString.startsWith("iexcl;", 1)) {
  288.                   return 161;
  289.                } else if (theString.startsWith("iquest;", 1)) {
  290.                   return 191;
  291.                }
  292.             case 'l':
  293.                if (theString.startsWith("lpar;", 1)) {
  294.                   return 40;
  295.                } else if (theString.startsWith("lt;", 1)) {
  296.                   return 60;
  297.                } else if (theString.startsWith("lsqb;", 1)) {
  298.                   return 91;
  299.                } else if (theString.startsWith("lowbar;", 1)) {
  300.                   return 95;
  301.                } else if (theString.startsWith("lcub;", 1)) {
  302.                   return 123;
  303.                } else if (theString.startsWith("laquo;", 1)) {
  304.                   return 171;
  305.                }
  306.             case 'm':
  307.                if (theString.startsWith("minus;", 1)) {
  308.                   return 45;
  309.                } else if (theString.startsWith("macr;", 1)) {
  310.                   return 175;
  311.                } else if (theString.startsWith("micro;", 1)) {
  312.                   return 181;
  313.                } else if (theString.startsWith("middot;", 1)) {
  314.                   return 183;
  315.                }
  316.             case 'n':
  317.                if (theString.startsWith("ntilde;", 1)) {
  318.                   return 241;
  319.                } else if (theString.startsWith("num;", 1)) {
  320.                   return 35;
  321.                } else if (theString.startsWith("nbsp;", 1)) {
  322.                   return 160;
  323.                } else if (theString.startsWith("not;", 1)) {
  324.                   return 172;
  325.                }
  326.             case 'o':
  327.                if (theString.startsWith("ograve;", 1)) {
  328.                   return 242;
  329.                } else if (theString.startsWith("oacute;", 1)) {
  330.                   return 243;
  331.                } else if (theString.startsWith("ocirc;", 1)) {
  332.                   return 244;
  333.                } else if (theString.startsWith("otilde;", 1)) {
  334.                   return 245;
  335.                } else if (theString.startsWith("ouml;", 1)) {
  336.                   return 246;
  337.                } else if (theString.startsWith("oslash;", 1)) {
  338.                   return 248;
  339.                } else if (theString.startsWith("ordf;", 1)) {
  340.                   return 170;
  341.                } else if (theString.startsWith("ordm;", 1)) {
  342.                   return 186;
  343.                }
  344.             case 'p':
  345.                if (theString.startsWith("percnt;", 1)) {
  346.                   return 37;
  347.                } else if (theString.startsWith("plus;", 1)) {
  348.                   return 43;
  349.                } else if (theString.startsWith("period;", 1)) {
  350.                   return 46;
  351.                } else if (theString.startsWith("pound;", 1)) {
  352.                   return 163;
  353.                } else if (theString.startsWith("plusmn;", 1)) {
  354.                   return 177;
  355.                } else if (theString.startsWith("para;", 1)) {
  356.                   return 182;
  357.                }
  358.             case 'q':
  359.                if (theString.startsWith("quot;", 1)) {
  360.                   return 34;
  361.                } else if (theString.startsWith("quest;", 1)) {
  362.                   return 63;
  363.                }
  364.             case 'r':
  365.                if (theString.startsWith("rpar;", 1)) {
  366.                   return 41;
  367.                } else if (theString.startsWith("rsqb;", 1)) {
  368.                   return 93;
  369.                } else if (theString.startsWith("rcub;", 1)) {
  370.                   return 125;
  371.                } else if (theString.startsWith("reg;", 1)) {
  372.                   return 174;
  373.                } else if (theString.startsWith("raquo;", 1)) {
  374.                   return 187;
  375.                }
  376.             case 's':
  377.                if (theString.startsWith("sp;", 1)) {
  378.                   return 32;
  379.                } else if (theString.startsWith("sol;", 1)) {
  380.                   return 47;
  381.                } else if (theString.startsWith("semi;", 1)) {
  382.                   return 59;
  383.                } else if (theString.startsWith("sim;", 1)) {
  384.                   return 126;
  385.                } else if (theString.startsWith("sect;", 1)) {
  386.                   return 167;
  387.                } else if (theString.startsWith("shy;", 1)) {
  388.                   return 173;
  389.                } else if (theString.startsWith("sup2;", 1)) {
  390.                   return 178;
  391.                } else if (theString.startsWith("sup3;", 1)) {
  392.                   return 179;
  393.                } else if (theString.startsWith("sup1;", 1)) {
  394.                   return 185;
  395.                }
  396.             case 't':
  397.                if (theString.startsWith("thorn;", 1)) {
  398.                   return 254;
  399.                } else if (theString.startsWith("tilde;", 1)) {
  400.                   return 126;
  401.                } else if (theString.startsWith("times;", 1)) {
  402.                   return 215;
  403.                }
  404.             case 'u':
  405.                if (theString.startsWith("ugrave;", 1)) {
  406.                   return 249;
  407.                } else if (theString.startsWith("uacute;", 1)) {
  408.                   return 250;
  409.                } else if (theString.startsWith("ucirc;", 1)) {
  410.                   return 251;
  411.                } else if (theString.startsWith("uuml;", 1)) {
  412.                   return 252;
  413.                } else if (theString.startsWith("uml;", 1)) {
  414.                   return 168;
  415.                }
  416.             case 'y':
  417.                if (theString.startsWith("yacute;", 1)) {
  418.                   return 253;
  419.                } else if (theString.startsWith("yuml;", 1)) {
  420.                   return 255;
  421.                } else if (theString.startsWith("yen;", 1)) {
  422.                   return 165;
  423.                }
  424.             default:
  425.                return 0;
  426.          }
  427.       }
  428.    }
  429.  
  430.    public Color GetColourFromString(String theParam) {
  431.       if (theParam.equalsIgnoreCase("BLACK")) {
  432.          return Color.black;
  433.       } else if (theParam.equalsIgnoreCase("BLUE")) {
  434.          return Color.blue;
  435.       } else if (theParam.equalsIgnoreCase("CYAN")) {
  436.          return Color.cyan;
  437.       } else if (theParam.equalsIgnoreCase("DARKGRAY")) {
  438.          return Color.darkGray;
  439.       } else if (theParam.equalsIgnoreCase("GRAY")) {
  440.          return Color.gray;
  441.       } else if (theParam.equalsIgnoreCase("GREEN")) {
  442.          return Color.green;
  443.       } else if (theParam.equalsIgnoreCase("LIGHTGRAY")) {
  444.          return Color.lightGray;
  445.       } else if (theParam.equalsIgnoreCase("MAGENTA")) {
  446.          return Color.magenta;
  447.       } else if (theParam.equalsIgnoreCase("ORANGE")) {
  448.          return Color.orange;
  449.       } else if (theParam.equalsIgnoreCase("PINK")) {
  450.          return Color.pink;
  451.       } else if (theParam.equalsIgnoreCase("RED")) {
  452.          return Color.red;
  453.       } else if (theParam.equalsIgnoreCase("WHITE")) {
  454.          return Color.white;
  455.       } else {
  456.          return theParam.equalsIgnoreCase("YELLOW") ? Color.yellow : Color.black;
  457.       }
  458.    }
  459.  
  460.    public boolean mouseExit(Event evt, int x, int y) {
  461.       this.notUpdatedYet = true;
  462.       this.mouseOut = true;
  463.       return true;
  464.    }
  465.  
  466.    public boolean mouseMove(Event evt, int x, int y) {
  467.       if (this.theURLToGoTo != null && this.notUpdatedYet) {
  468.          this.notUpdatedYet = false;
  469.       }
  470.  
  471.       return true;
  472.    }
  473.  
  474.    public boolean mouseDown(Event evt, int x, int y) {
  475.       if (this.theURLToGoTo != null) {
  476.       }
  477.  
  478.       return true;
  479.    }
  480.  
  481.    public boolean mouseEnter(Event evt, int x, int y) {
  482.       if (this.theURLToGoTo != null) {
  483.       }
  484.  
  485.       this.mouseOut = false;
  486.       return true;
  487.    }
  488.  
  489.    public boolean mouseDrag(Event evt, int x, int y) {
  490.       if (this.theURLToGoTo != null && this.notUpdatedYet) {
  491.          this.notUpdatedYet = false;
  492.       }
  493.  
  494.       return true;
  495.    }
  496.  
  497.    private void DrawOffScreenBackground() {
  498.       this.offScreenGraphics.setColor(this.backGround);
  499.       this.offScreenGraphics.fillRect(0, 0, this.offScreenSize.width, this.offScreenSize.height);
  500.    }
  501.  
  502.    public String getAppletInfo() {
  503.       return new String("NetObjects TickerTape");
  504.    }
  505.  
  506.    public void ISO8859() {
  507.    }
  508.  
  509.    public void setBackgroundColor(String color) {
  510.       this.backGround = this.GetColourFromString(color);
  511.       this.DrawOffScreenBackground();
  512.       ((Component)this).repaint();
  513.    }
  514.  
  515.    public boolean mouseUp(Event evt, int x, int y) {
  516.       int cnt = -1;
  517.       int position = x + this.theOffScreenPosition - this.theDisplayWidth;
  518.       if (position >= this.starts[0] && position < this.starts[this.numTokens]) {
  519.          for(cnt = 1; cnt < this.numTokens && position >= this.starts[cnt]; ++cnt) {
  520.          }
  521.  
  522.          this.theURLToGoTo = this.theURLs[cnt - 1];
  523.       } else {
  524.          this.theURLToGoTo = null;
  525.       }
  526.  
  527.       if (this.theURLToGoTo != null && !this.mouseOut) {
  528.          ((Applet)this).getAppletContext().showDocument(this.theURLToGoTo);
  529.       }
  530.  
  531.       return true;
  532.    }
  533.  
  534.    public String ISOtoHTML(int theChar) {
  535.       return theChar >= 0 && theChar <= 255 ? this.theEntities[theChar] : "";
  536.    }
  537.  
  538.    public void run() {
  539.       while(true) {
  540.          try {
  541.             Thread.currentThread();
  542.             Thread.sleep(this.speed);
  543.          } catch (InterruptedException var3) {
  544.          }
  545.  
  546.          super.repaint();
  547.       }
  548.    }
  549.  
  550.    public String About() {
  551.       return "Netobjects TickerTape";
  552.    }
  553.  
  554.    private URL MakeAbsoluteURL(String param) throws MalformedURLException {
  555.       URL theURL = null;
  556.       String fullBase = ((Applet)this).getDocumentBase().toString();
  557.       String documentBase = fullBase.substring(0, fullBase.lastIndexOf(47));
  558.  
  559.       try {
  560.          if (param.startsWith(".")) {
  561.             param = param.replace('\\', '/');
  562.             param = documentBase + "/" + param;
  563.          } else if (param.startsWith("#")) {
  564.             param = ((Applet)this).getDocumentBase().toString() + param;
  565.          } else if (!param.startsWith("cid:") && !param.startsWith("lifn:") && !param.startsWith("java:") && !param.startsWith("irc:") && !param.startsWith("IOR:") && !param.startsWith("ilu:") && !param.startsWith("https:") && !param.startsWith("http:") && !param.startsWith("hdl:") && !param.startsWith("gopher:") && !param.startsWith("ftp:") && !param.startsWith("finger:") && !param.startsWith("file:") && !param.startsWith("data:") && !param.startsWith("clsid:") && !param.startsWith("md5:") && !param.startsWith("mailserver:") && !param.startsWith("mailto:") && !param.startsWith("mid:") && !param.startsWith("news:") && !param.startsWith("nntp:") && !param.startsWith("path:") && !param.startsWith("prospero:") && !param.startsWith("service:") && !param.startsWith("shttp") && !param.startsWith("snews") && !param.startsWith("STANF:") && !param.startsWith("telnet:") && !param.startsWith("vemmi:") && !param.startsWith("wais:") && !param.startsWith("whois++:")) {
  566.             param = "http://" + param;
  567.          }
  568.  
  569.          theURL = new URL(param);
  570.       } catch (MalformedURLException var7) {
  571.          theURL = null;
  572.       }
  573.  
  574.       return theURL;
  575.    }
  576.  
  577.    public void init() {
  578.       String param = ((Applet)this).getParameter("speed");
  579.       this.SetSpeed(param == null ? 100L : 5L * (51L - Integer.valueOf(param).longValue()));
  580.       param = ((Applet)this).getParameter("framecolour");
  581.       if (param == null) {
  582.          param = ((Applet)this).getParameter("framecolor");
  583.       }
  584.  
  585.       this.frameColour = param == null ? Color.green : this.GetColourFromString(param);
  586.       param = ((Applet)this).getParameter("backcolour");
  587.       if (param == null) {
  588.          param = ((Applet)this).getParameter("backcolor");
  589.       }
  590.  
  591.       this.backGround = param == null ? Color.black : this.GetColourFromString(param);
  592.       param = ((Applet)this).getParameter("LEDcolour");
  593.       if (param == null) {
  594.          param = ((Applet)this).getParameter("LEDcolor");
  595.       }
  596.  
  597.       this.LEDColour = param == null ? Color.green : this.GetColourFromString(param);
  598.       param = ((Applet)this).getParameter("ledoffcolour");
  599.       if (param == null) {
  600.          param = ((Applet)this).getParameter("ledoffcolor");
  601.       }
  602.  
  603.       this.LEDOffColour = param == null ? this.backGround : this.GetColourFromString(param);
  604.       param = ((Applet)this).getParameter("FrameThick");
  605.       this.frameThickness = param == null ? 1 : Integer.valueOf(param);
  606.       param = ((Applet)this).getParameter("LEDSize");
  607.       this.ledSize = param == null ? 2 : Integer.valueOf(param);
  608.       param = ((Applet)this).getParameter("scrollfactor");
  609.       this.scrollFactor = param == null ? 2 : Integer.valueOf(param);
  610.       param = ((Applet)this).getParameter("ledspacing");
  611.       this.ledSpacing = param == null ? 1 : Integer.valueOf(param);
  612.       param = ((Applet)this).getParameter("ledtype");
  613.       this.ledType = param == null ? 0 : Integer.valueOf(param);
  614.       if (this.ledType > 1) {
  615.          this.ledType = 1;
  616.       }
  617.  
  618.       if (this.ledSize == 1) {
  619.          this.ledType = 0;
  620.       }
  621.  
  622.       param = ((Applet)this).getParameter("width");
  623.       int theWidth = param == null ? 80 : Integer.valueOf(param);
  624.       param = ((Applet)this).getParameter("height");
  625.       int theHeight = param == null ? 39 : Integer.valueOf(param);
  626.       ((Applet)this).resize(theWidth, theHeight);
  627.       this.theDisplayWidth = theWidth - this.frameThickness * 2 - 1;
  628.       this.theXOffset = this.frameThickness + 1;
  629.       this.theYOffset = (theHeight - (this.ledSize + this.ledSpacing) * 11) / 2;
  630.       String allTheText = "";
  631.       Vector theTexts = new Vector();
  632.  
  633.       String theText;
  634.       for(int cnt = 1; (theText = ((Applet)this).getParameter("text" + cnt)) != null; ++cnt) {
  635.          int theTextLength = theText.length();
  636.          StringBuffer finalText = new StringBuffer();
  637.  
  638.          for(int i = 0; i < theTextLength; ++i) {
  639.             if (theText.charAt(i) != '&') {
  640.                finalText.append(theText.charAt(i));
  641.             } else {
  642.                int semiColon = theText.indexOf(59, i + 1);
  643.                int theChar;
  644.                if (semiColon != -1) {
  645.                   theChar = this.HTMLtoISO(theText.substring(i, semiColon + 1));
  646.                   if (theChar == 0) {
  647.                      theChar = 38;
  648.                   } else {
  649.                      i = semiColon;
  650.                   }
  651.                } else {
  652.                   theChar = 38;
  653.                }
  654.  
  655.                finalText.append((char)theChar);
  656.             }
  657.          }
  658.  
  659.          theText = finalText.toString();
  660.          allTheText = allTheText + theText;
  661.          theTexts.addElement(theText);
  662.       }
  663.  
  664.       this.numTokens = theTexts.size();
  665.       this.starts = new int[this.numTokens + 1];
  666.       this.starts[0] = this.theDisplayWidth;
  667.  
  668.       for(int cnt = 1; cnt <= this.numTokens; ++cnt) {
  669.          this.starts[cnt] = this.starts[cnt - 1] + ((String)theTexts.elementAt(cnt - 1)).length() * 6 * (this.ledSize + this.ledSpacing);
  670.       }
  671.  
  672.       theText = allTheText;
  673.       int var27 = allTheText.length();
  674.       int theNumberOfLines = allTheText.length() * 6 + 2 * this.theDisplayWidth / (this.ledSize + this.ledSpacing);
  675.       this.offScreenSize = new Dimension(theNumberOfLines * (this.ledSize + this.ledSpacing), (this.ledSize + this.ledSpacing) * 11);
  676.       this.offScreenImage = ((Component)this).createImage(this.offScreenSize.width, this.offScreenSize.height);
  677.       this.offScreenGraphics = this.offScreenImage.getGraphics();
  678.       this.theOffScreenPosition = this.theDisplayWidth;
  679.       this.DrawOffScreenBackground();
  680.       theNumberOfLines = this.theDisplayWidth / (this.ledSize + this.ledSpacing);
  681.       this.offScreenGraphics.setColor(this.LEDOffColour);
  682.  
  683.       for(int var22 = 0; var22 < theNumberOfLines; ++var22) {
  684.          int k = 0;
  685.  
  686.          while(true) {
  687.             if (this.ledType == 0) {
  688.                this.offScreenGraphics.fillRect(var22 * (this.ledSize + this.ledSpacing), k * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  689.             } else {
  690.                this.offScreenGraphics.fillOval(var22 * (this.ledSize + this.ledSpacing), k * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  691.             }
  692.  
  693.             ++k;
  694.             if (k >= 11) {
  695.                break;
  696.             }
  697.          }
  698.       }
  699.  
  700.       int displacement = (theNumberOfLines - 1) * (this.ledSize + this.ledSpacing);
  701.  
  702.       for(int var23 = 0; var23 < var27; ++var23) {
  703.          int j = 0;
  704.  
  705.          while(true) {
  706.             int theLine = this.GetLine(theText.charAt(var23), j);
  707.             int var25 = 0;
  708.  
  709.             do {
  710.                int theBit = theLine >> var25;
  711.                if ((theBit & 1) == 1) {
  712.                   this.offScreenGraphics.setColor(this.LEDColour);
  713.                } else {
  714.                   this.offScreenGraphics.setColor(this.LEDOffColour);
  715.                }
  716.  
  717.                if (this.ledType == 0) {
  718.                   this.offScreenGraphics.fillRect(displacement + (var23 * 6 + j) * (this.ledSize + this.ledSpacing), var25 * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  719.                } else {
  720.                   this.offScreenGraphics.fillOval(displacement + (var23 * 6 + j) * (this.ledSize + this.ledSpacing), var25 * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  721.                }
  722.  
  723.                ++var25;
  724.             } while(var25 < 11);
  725.  
  726.             ++j;
  727.             if (j >= 6) {
  728.                break;
  729.             }
  730.          }
  731.       }
  732.  
  733.       displacement += var27 * 6 * (this.ledSize + this.ledSpacing);
  734.       theNumberOfLines = this.theDisplayWidth / (this.ledSize + this.ledSpacing);
  735.       this.offScreenGraphics.setColor(this.LEDOffColour);
  736.  
  737.       for(int var24 = 0; var24 < theNumberOfLines; ++var24) {
  738.          int var26 = 0;
  739.  
  740.          while(true) {
  741.             if (this.ledType == 0) {
  742.                this.offScreenGraphics.fillRect(displacement + var24 * (this.ledSize + this.ledSpacing), var26 * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  743.             } else {
  744.                this.offScreenGraphics.fillOval(displacement + var24 * (this.ledSize + this.ledSpacing), var26 * (this.ledSize + this.ledSpacing), this.ledSize, this.ledSize);
  745.             }
  746.  
  747.             ++var26;
  748.             if (var26 >= 11) {
  749.                break;
  750.             }
  751.          }
  752.       }
  753.  
  754.       this.theURLs = new URL[this.numTokens];
  755.  
  756.       for(int cnt = 1; cnt <= this.numTokens; ++cnt) {
  757.          param = ((Applet)this).getParameter("link" + cnt);
  758.          if (param != null) {
  759.             try {
  760.                this.theURLToGoTo = this.MakeAbsoluteURL(param);
  761.             } catch (MalformedURLException var21) {
  762.                this.theURLToGoTo = null;
  763.             }
  764.  
  765.             this.theURLs[cnt - 1] = this.theURLToGoTo;
  766.          }
  767.       }
  768.  
  769.    }
  770.  
  771.    public void paint(Graphics g) {
  772.       Color oldColour = g.getColor();
  773.       g.setColor(this.frameColour);
  774.       g.fillRect(0, 0, ((Component)this).bounds().width, ((Component)this).bounds().height);
  775.       g.setColor(this.backGround);
  776.       g.fillRect(this.frameThickness, this.frameThickness, this.theDisplayWidth, ((Component)this).bounds().height - this.frameThickness * 2 - 1);
  777.       this.update(g);
  778.       g.setColor(oldColour);
  779.    }
  780.  
  781.    public final synchronized void update(Graphics g) {
  782.       g.clipRect(this.theXOffset, this.theYOffset, this.theDisplayWidth - 2, this.offScreenSize.height);
  783.       int theTranslation = this.theOffScreenPosition > this.theDisplayWidth ? this.theOffScreenPosition - this.theDisplayWidth : -(this.theDisplayWidth - this.theOffScreenPosition);
  784.       g.drawImage(this.offScreenImage, -theTranslation + this.theXOffset, this.theYOffset, this);
  785.       this.theOffScreenPosition += (this.ledSize + this.ledSpacing) * this.scrollFactor;
  786.       if (this.theOffScreenPosition > this.offScreenSize.width) {
  787.          this.theOffScreenPosition = this.theDisplayWidth;
  788.       }
  789.  
  790.    }
  791.  
  792.    public void SetSpeed(long theNewSpeed) {
  793.       this.speed = theNewSpeed;
  794.    }
  795.  
  796.    public long GetSpeed() {
  797.       return this.speed;
  798.    }
  799. }
  800.